@layout("/common/_curd/_container.html"){

<script type="text/javascript">
	var ctx = "${basePath}";
	var grid_selector = "#grid-table";
	var pager_selector = "#grid-pager";
	
	$(function(){
		initGrid();
		initMenuBtn("btns", "${code}");
	});
	
	function initGrid(){
		var grid_url = ctx + "/${code}/list";
		var _colnames = ["", 
						"进货时间",
						"数量", 
						"供应商",
						"采购方",
						"商品",
						"生产日期", 
						"生产批号", 
						"检测报告编号",
						"检测报告图片",
			"审核状态",
						"追溯码"
							];
		var _colmodel = [{name:"id", hidden:true,index:"id", width:100},

						{name:"date", index:"date", width:100},
						{name:"num", index:"num", width:100},
						{name:"supname", index:"supname", width:100},
						{name:"scname", index:"scname", width:100},
						{name:"pname", index:"pname", width:100},
						{name:"product_date", index:"product_date", width:100},
						{name:"product_code", index:"product_code", width:100},
						{name:"checks", index:"checks", width:100},
						{name:"url", index:"url", width:100,formatter:function (value, row, index) {
							return  '<image height="75px" width="100px" src="'+value+'"></image>';
						}},
			{name:"status", index:"status", width:100,formatter:function (value, row, index) {
				if(value === 1){
					return "已通过";
				}else if(value === 2){
					return "未通过";
				}else{
					return "未审核";
				}
			}},
						{name:"code", index:"code", width:100}
		];
		
		jQuery(grid_selector).jqGrid({
			url : grid_url,
		    shrinkToFit : true,
			colNames : _colnames,
			colModel : _colmodel, 
			jsonReader : {id :"id"},
			pager : pager_selector,
			postData : {sort : "id", order : "desc"}
		});
	}
</script>


	<!-- 配置 grid -->
	<div class="row">
		<div class="col-xs-12 tb-grid">
			<!-- 配置 查询 -->
			@ var _col=[
			@		{name:"进货时间", index:"date", type:"text"},
			@		{name:"供应商", index:"supp_id", type:"text"},
			@		{name:"采购方", index:"school_id", type:"text"},
			@		{name:"商品", index:"product_id", type:"text"},
			@		{name:"检测报告编号", index:"checks", type:"text"}
			@];
			@ include("/common/_function/_search.html",{"col":_col}){}
			<!-- 按钮 -->

			<label for="zdzd">自动联想输入</label>
			<input type="text" id = "zdzd" autocomplete="off">
			<div class="welljq well-sm" id="btns"></div>
			<!-- grid -->
			<table id="grid-table"></table>
			<!-- 分页-->
			<div id="grid-pager"></div>
		</div>
	</div>
	
	<!-- 引入所需的js -->
	@include("/common/_listscript.html"){}

<!--<script type="text/javascript">-->
	<!--$(function () {-->
		<!--var search = $("#zdzd");-->

<!--//				var source = new Array();//[{"name":"zhangkun"},{"name":"dashen"}]//["aab","aac","bbd","bbn"];-->
		<!--var source = ["aab","aac","bbd","bbn"];-->

		<!--search.autocomplete({-->
			<!--source: source,-->
			<!--messages: {  //message设置不出现匹配关键字的结果-->
				<!--noResults: '',-->
				<!--results: function () {-->
				<!--}-->
			<!--}-->
		<!--});-->

		<!--search.keyup(function () {-->
			<!--$.ajax({-->
				<!--type: "POST",-->
				<!--url: "/blog/add",-->
				<!--data: {search: $("#zdzd").val()},-->
				<!--success: function (data) {-->
					<!--var obj = eval(data); //将json转换为对象的方法-->
					<!--for (var i = 0; i < obj.length; i++) {-->
						<!--source[i] = obj[i].username;-->
					<!--}-->
				<!--}-->
			<!--});-->
		<!--});-->
	<!--});-->
<!--</script>-->
<script>
	var availableTags = [
		"ActionScript",
		"AppleScript",
		"Asp",
		"BASIC",
		"C",
		"C++",
		"Clojure",
		"COBOL",
		"ColdFusion",
		"Erlang",
		"Fortran",
		"Groovy",
		"Haskell",
		"Java",
		"JavaScript",
		"Lisp",
		"Perl",
		"PHP",
		"Python",
		"Ruby",
		"Scala",
		"Scheme"
	];
	$( '#zdzd').autocomplete({
		source: availableTags
	});
</script>
@}
